From 6e59829ed251d470ee10db233e8eb6935dc0e9c9 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Mon, 25 Dec 2006 14:32:41 +0000 Subject: [PATCH] Adjust the argument counts for a MESSAGE_PARAMETER_COUNT_MISMATCH to account for the fact that XenAPI adds the session handle transparently. Signed-off-by: Ewan Mellor --- tools/python/xen/xm/XenAPI.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/tools/python/xen/xm/XenAPI.py b/tools/python/xen/xm/XenAPI.py index b45249e7ec..a8cfce8751 100644 --- a/tools/python/xen/xm/XenAPI.py +++ b/tools/python/xen/xm/XenAPI.py @@ -54,7 +54,17 @@ gettext.install('xen-xm') class Failure(Exception): def __init__(self, details): - self.details = details + try: + # If this failure is MESSAGE_PARAMETER_COUNT_MISMATCH, then we + # correct the return values here, to account for the fact that we + # transparently add the session handle as the first argument. + if details[0] == 'MESSAGE_PARAMETER_COUNT_MISMATCH': + details[2] = str(int(details[2]) - 1) + details[3] = str(int(details[3]) - 1) + + self.details = details + except Exception, exn: + self.details = ['INTERNAL_ERROR', 'Client-side: ' + str(exn)] def __str__(self): try: -- 2.30.2